<?php



class Bootstrap extends Zend_Application_Bootstrap_Bootstrap

{

	protected function _initAutoload()

	{

		$modelLoader = new Zend_Application_Module_Autoloader(array('namespace'=>'','basePath'=>APPLICATION_PATH));

		



		require_once 'Plugins/PlayerStats.php';

		$this->getApplication()

			->getAutoloader()

			->pushAutoloader(array('Plugins', 'autoload'),

			'PlayerStats');

		

		$this->bootstrap('db');

		$db = $this->getResource('db');

		

		$playerStats = new Application_Model_PlayerStats;

		$fc = Zend_Controller_Front::getInstance();

		$user_id = Zend_Auth::getInstance()->getIdentity()->id; 

		if ($user_id != null ) {

			$fc->registerPlugin(new Plugin_PlayerStats($playerStats,$user_id));	

		}

		

		return $modelLoader;

		

	}

	

	

	function _initViewHelpers(){

		

		$this->bootstrap('layout');

		$layout = $this->getResource('layout');

		$view = $layout->getView();

		

		$view->username = Zend_Auth::getInstance()->getIdentity()->username;

		

		$view->doctype('XHTML1_TRANSITIONAL');

		$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');

		

		$view->headTitle('Realm Domination');

		$view->headTitle()->setSeparator(' - ');

		$view->headLink(array('rel' => 'shortcut icon',

                                  'href' => '/images/favicon.ico'),

                                  'PREPEND');

								  

		//add javascript

		$view->headScript()->appendFile($view->baseUrl('/js/jquery-1.7.min.js'));

		$view->headScript()->appendFile($view->baseUrl('/js/custom.js'));

		$view->headScript()->appendFile($view->baseUrl('/js/jquery.tools.min.js'));

		$view->headScript()->appendFile($view->baseUrl('/js/login.js'));
		
		$view->headScript()->appendFile($view->baseUrl('/js/register.js'));

		$view->headScript()->appendFile($view->baseUrl('/js/jquery.login.js'));

		$view->headScript()->appendFile('/js/prototype.js','text/javascript',array('conditional' => 'lt IE 7'));	  



		

		$view->headLink()->appendStylesheet($view->baseUrl('/css/design-remake.css'));

		/*$view->headLink()->appendStylesheet($view->baseUrl('/css/design.css'));*/

		$view->headLink()->appendStylesheet($view->baseUrl('/css/reset.css'));

		$view->headLink()->appendStylesheet($view->baseUrl('/css/tabs.css'));

		$view->headLink()->appendStylesheet($view->baseUrl('/css/login.css'));

		

		$view->date = new Zend_Date();



		$navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH. '/configs/navigation.xml','nav');

		$navContainer = new Zend_Navigation($navContainerConfig);

		$view->navigation($navContainer);

		

	}

	

	

}



